using System.Collections.Generic;
using I2.Loc;
using UnityEngine;

public class TutMoving : TutorialBase
{
	public bool moveComplete;

	public List<TutorialCheckpoint> listCheckPoint = new List<TutorialCheckpoint>();

	private bool beginStepHello;

	public override void OnStart()
	{
		base.OnStart();
		ShowText(ScriptLocalization.Get("Tutorial/src_Tutorial_Move"), 0f);
		TutorialManager.instance.stepTutorialForFlurry = "4 Moving";
		base.gameObject.SetActive(true);
		GameController.instance.playerScript.weaponManager.ActivateWeaponSlot("rifles");
		GameController.instance.playerScript.weaponManager.switchWeapon("rifles", "Tutorial_Famas", string.Empty);
		GameController.instance.playerScript.weaponManager.ActivateWeaponSlot("melee");
		GameController.instance.playerScript.weaponManager.switchWeapon("melee", "knuckles", string.Empty);
		TutorialManager.instance.PlayAnimButton(TutorialButtonId.joystick);
		TutorialCollider.instance.curCollider = TutorialCollider.TypeCollider.Start;
		TutorialManager.instance.GetTutorialButtonById(TutorialButtonId.shoot).gameObject.SetActive(false);
		TutorialManager.instance.GetTutorialButtonById(TutorialButtonId.joystick).gameObject.SetActive(true);
		WindowManager.instance.ShowWindow(typeof(WalkWindow), false);
		TutorialManager.instance.tony.ToggleCallPlayerAnimation(true);
	}

	public override void OnStop()
	{
		HideText();
		base.OnStop();
	}

	public override void OnUpdate()
	{
		if (beginStepHello)
		{
			return;
		}
		moveComplete = true;
		foreach (TutorialCheckpoint item in listCheckPoint)
		{
			if (!item.isActive)
			{
				moveComplete = false;
			}
		}
		if (moveComplete)
		{
			beginStepHello = true;
			StepHello();
		}
	}

	private void StepHello()
	{
		TutorialManager.instance.StopAnimAllButton();
		TutorialManager.instance.GetTutorialButtonById(TutorialButtonId.joystick).parentObj.SetActive(false);
		TutorialManager.instance.GetTutorialButtonById(TutorialButtonId.joystick).gameObject.SetActive(false);
		GameController.instance.playerScript.tController.joyScript.position = Vector2.zero;
		GameController.instance.playerScript.canMove = false;
		TutorialManager.instance.tony.ToggleCallPlayerAnimation(false);
		HideText();
		ShowText(ScriptLocalization.Get("Tutorial/src_Tutorial_Hello"), 0f, true);
		Invoke("OnComplete", 4f);
	}

	public override void OnComplete()
	{
		TutorialManager.instance.GetTutorialButtonById(TutorialButtonId.joystick).gameObject.SetActive(true);
		TutorialManager.instance.GetTutorialButtonById(TutorialButtonId.joystick).parentObj.SetActive(true);
		GameController.instance.playerScript.canMove = true;
		TutorialManager.instance.tony.SetTarget(TutorialManager.instance.tonyWaitPoint);
		TutorialManager.instance.tony.SetState(ScriptHumanState.MoveTarget);
		PointerController.instance.RemoveAllPointers();
		base.OnComplete();
	}
}
